<?php
class CTransactionProduct {
	var $product_id;
	var $product_code;
	var $product_name;
	var $product_price;
	var $product_quantity;
}


class CTransactionDetail {
	var $portal_id;
	var $buyer_id;
	var $buyer_full_name;
	var $buyer_address;
	var $buyer_phone;
	var $buyer_mobile;
	var $buyer_id_card;
	var $payment_method;
	var $transport_method;
	var $receiver_name;
	var $receiver_address;
	var $amount;
	var $shipping_fee;
	var $free_shipping;
	var $payment_fee;
	var $notice;
	var $receiver_zone_id;
	var $receiver_id_card;
	var $receiver_phone;
	var $receiver_mobile;
	var $waiting_time;
	var $is_deleted;
	var $created_time;
	var $receive_time;
	var $status;
	var $application_code;
	var $buyer_email;

	/**
	 * Array of CProductDetail
	 *
	 * @var CProductDetail[]
	 */
	var $products;

	/**
	 * Create CTransactionDetail object from an array
	 *
	 * @param array $ar
	 * @return CTransactionDetail
	 */
	public static function createFromArray($ar, $products) {
		$trans = new CTransactionDetail();
		foreach ($ar as $key=>$value) {
			$trans->$key = $value;
		}
		$trans->products = $products;
		return $trans;
	}
}